package com.sunlands.zlcx.usercenter.service;

import com.sunlands.zlcx.usercenter.domain.UserCardsDO;
import com.sunlands.zlcx.usercenter.repository.UserCardsRepository;
import com.sunlands.zlcx.usercenter.vo.UserCardsVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author anjl
 * @date 6:23 PM 2019/7/11
 * description:
 */

@Slf4j
@Service
public class UserCardsServiceImpl {

    public UserCardsVO save(UserCardsDO userCards){
        return UserCardsVO.from(userCardsRepository.save(userCards));
    }

    public Boolean existsByUserId(Long userId) {
        return userCardsRepository.existsByUserId(userId);
    }

    public Boolean existsByCard(String card) {
        return userCardsRepository.existsByCard(card);
    }

    @Autowired
    private UserCardsRepository userCardsRepository;
}
